/**
 * Created by Administrator on 2016/3/12.
 */
    //创建样式css
    var maskCss = document.createElement('style');
    maskCss.type = 'text/css';
    maskCss.innerHTML= '.overall-mask{position: fixed;left: 0;top: 0;width: 100%;height: 100%;background-color: #fff;z-index: 99999;}' +
    '.overall-mask-close{  -webkit-animation-name: overall-mask-close;  animation-name: overall-mask-close;  -webkit-animation-duration: 0.5s;  animation-duration: 0.5s;  -webkit-animation-timing-function: ease;  animation-timing-function: ease;  -webkit-animation-fill-mode: forwards;  animation-fill-mode: forwards;  }' +
    '@-webkit-keyframes overall-mask-close { 0%{opacity: 1;} 100%{opacity: 0;visibility: hidden;} }' +
    '@keyframes overall-mask-close { 0%{opacity: 1;} 100%{opacity: 0;visibility: hidden;} }' +
    '.overall-mask-open{  -webkit-animation-name: overall-mask-open;  animation-name: overall-mask-open;  -webkit-animation-duration: 0.3s;  animation-duration: 0.3s;  -webkit-animation-timing-function: ease;  animation-timing-function: ease;  -webkit-animation-fill-mode: forwards;  animation-fill-mode: forwards;  }' +
    '@-webkit-keyframes overall-mask-open { 0%{opacity: 0;} 100%{opacity: 1;visibility: visible;} }' +
    '@keyframes overall-mask-open { 0%{opacity: 0;} 100%{opacity: 1;visibility: visible;} }';
    document.getElementsByTagName('head').item(0).appendChild(maskCss);
    //创建遮罩元素
    var maskDiv = document.createElement('div');
    maskDiv.setAttribute('class','overall-mask');
    document.body.appendChild(maskDiv);

    //界面加载完成
    //document.onreadystatechange = function() {
    //    if(document.readyState == "complete"){
    //        var mask = document.getElementsByClassName('overall-mask')[0];
    //        mask.className += " overall-mask-close";
    //    }
    //};
    window.onload = function(){
         document.getElementsByClassName('overall-mask')[0].className += " overall-mask-close";
    };
//打开弹出框
function openModalMask(){
    $(".mask").removeClass("mask-close").addClass("mask-open");
    $(".modal").removeClass("modal-close").addClass("modal-open");
}
//关闭弹出框
function closeModalMask(){
    $(".mask").removeClass("mask-open").addClass("mask-close");
    $(".modal").removeClass("modal-open").addClass("modal-close");
}
